//
//  IGUUIDManager.m
//  jingdongfang
//
//  Created by BOE on 2017/8/10.
//  Copyright © 2017年 ZhiYu Hao. All rights reserved.
//

#import "IGUUIDManager.h"
#import "IGKeyChain.h"

@implementation IGUUIDManager

static NSString * const KEY_IN_KEYCHAIN = @"com.iGallery.iGallery";
static NSString * const KEY_UUID = @"com.iGallery.iGallery.uuid";

+ (void)saveUUID:(NSString *)uuid
{
    NSMutableDictionary *usernameUuidPairs = [NSMutableDictionary dictionary];
    [usernameUuidPairs setObject:uuid forKey:KEY_UUID];
    [IGKeyChain save:KEY_IN_KEYCHAIN data:usernameUuidPairs];
}

+ (id)readUUID
{
    NSMutableDictionary *usernameUuidPairs = (NSMutableDictionary *)[IGKeyChain load:KEY_IN_KEYCHAIN];
    return [usernameUuidPairs objectForKey:KEY_UUID];
}

+ (void)deleteUUID
{
    [IGKeyChain delete:KEY_IN_KEYCHAIN];
}

@end
